package com.yc.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class EncryptUtils {
    public static String encrytToMD5(String str){
        try{
            MessageDigest md=MessageDigest.getInstance("MD5");
            md.update(str.getBytes());
            String hashdPwd=new BigInteger(1,md.digest()).toString(16);
            return hashdPwd;
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }
    }

    public static void main(String[] args) {
        System.out.println(EncryptUtils.encrytToMD5(EncryptUtils.encrytToMD5("a")));
    }
}
